package com.aigou.service.impl;

import com.aigou.dao.UserDAO;
import com.aigou.dao.impl.UserDAOImpl;
import com.aigou.entity.User;
import com.aigou.service.UserService;

import java.util.List;

public class UserServiceImpl implements UserService {
    //调用dao层对象
    private UserDAO userDAO = new UserDAOImpl();

    @Override
    public List<User> findAll() {
        return userDAO.selectAll();
    }

    @Override
    public User findById(String userId) {
        return userDAO.selectById(userId);
    }

    @Override
    public boolean save(User user) {
        return userDAO.insert(user);
    }

    @Override
    public boolean remove(String userId) {
        return userDAO.delete(userId);
    }

    @Override
    public boolean update(User user) {
        return userDAO.update(user);
    }
}
